<?php 
class FileUpload {
    
    public static function getFileName() {
        return $_SERVER['HTTP_X_FILE_NAME'];
    }
    
    public static function getFileType() {
        return $_SERVER['HTTP_X_FILE_TYPE'];
    }
    
    public static function getFileSize() {
        return $_SERVER['HTTP_X_FILE_SIZE'];
    }
    
    public static function simpleUpload($outputFile, $bufferSize=1024) {
        $upload = fopen("php://input", "r");
        $firstBunch = fread($upload, $bufferSize);
        if (strlen($firstBunch) > 0) {
            file_put_contents($outputFile, $firstBunch);
            while (!feof($upload)) {
                file_put_contents($outputFile, fread($upload, $bufferSize), FILE_APPEND);
            }
        } else return false;
        fclose($upload);
        return true;
    }
    
    
}